package cn.wolfcode.domain;

import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.Map;

@ApiModel(value="部门",description="部门列表")
@Getter
@Setter
public class Department {
    private Long id;

    @ApiModelProperty(value="部门名称",name="name",dataType = "String",required = true)
    private String name;

    @ApiModelProperty(value="部门名称简称",name="sn",dataType = "String",required = true)
    private String sn;

    @ApiModelProperty(value="部门实体的成员变量封装成json",name="json",dataType = "String",required = false)
    public String getJson(){
        Map<String,Object> map = new HashMap<>();
        map.put("id",this.id);
        map.put("name",this.name);
        map.put("sn",this.sn);
        String s = JSON.toJSONString(map);
        return s;
    }
}